﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Media;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Interval = 60000*Int32.Parse(textBox1.Text);
            //timer1.Interval = 1000;
            totalTime = 0;
            timer1.Start();
            timeLeft = timer1.Interval / 1000;
            timer2.Interval = 1000;
            timer2.Start();
            textBox2.Text = timeLeft.ToString();
            
            
        }
        private long totalTime;
        private long timeLeft;
   

        private void timer1_Tick(object sender, EventArgs e)
        {
            SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\chimes.wav");
            simpleSound.Play();
            totalTime = totalTime + timer1.Interval;
            MessageBox.Show("Take Measurement " + (totalTime/60000).ToString());
            


        
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            textBox2.Text = timeLeft.ToString();
            timeLeft--;
            if (timeLeft == 0)
            {
                timeLeft = timer2.Interval;
            }
        }


    }
}
